<template>
	<view class="bgf8">
		<scroll-view class="tab bgw pd30" scroll-y="true">
			<view class="commonlyItem" v-for="i in list" @click="getChoose(i.rp,i.typestr,i.list)">
				<view class="title">{{i.title}}</view>
				<view class="commonly"><text class="text">{{i.typestr}}</text><text v-for="item in i.list">{{item.name}}{{item.num}}{{item.danwei}};</text></view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		znkf
	} from '../../request/api.js'
	export default {
		data() {
			return {
				list: [],
				hidden:false
			}
		},
		onLoad(options) {
			this.getList(options.name)
		},
		methods: {
			// 获取信息
			getList(name) {
				znkf({keys:name}).then(res => {
					this.list = res.data
				})
			},
			getChoose(rp,name,arr){
				// console.log(rp,name,arr)
				let pages = getCurrentPages(); // 当前页面
				let beforePage = pages[pages.length - 2]; // 前一个页面
				let lists = arr.map(function(item) {
				    return {
				        id: item.yid,
				        danwei: item.danwei,
				        value: item.name,
						yongfaId:'',
						yongfaName:'',
						num:item.num
				    }
				});
				this.$nextTick(() => {
					if (beforePage.route == 'pages/meet/meet') {
						beforePage.$vm.arrayId1 = rp,//替换上个页面参数
						beforePage.$vm.arrayName1 = name,//替换上个页面参数
						beforePage.$vm.datas = lists,//替换上个页面参数
						uni.navigateBack()
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background: #f8f8f8;
	}

	.tab {
		padding-bottom: 30upx;
		
		.commonlyItem {
			padding: 40upx 0;
			border-bottom: 2upx solid #E5E5E5;
		
			.title {
				font-size: 32upx;
				font-family: Source Han Sans CN;
				font-weight: bold;
				margin-bottom: 20upx;
			}
		
			.commonly {
				width: 100%;
				font-size: 28upx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				line-height: 56upx;
				color: #7B7B7B;
		
				.text {
					background: #F4F4F6;
					// display: inline-block;
					padding: 6upx 8upx;
					font-size: 24upx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #9F9F9F;
					margin-right: 10upx;
				}
		
			}
		}
	}
</style>
